package com.fxcalibre.onlineServices.imdb;

import java.util.HashMap;
import java.util.List;

import com.fxcalibre.onlineServices.beans.NameResult;
import com.fxcalibre.onlineServices.imdb.parser.ImdbDetailParser;
import com.fxcalibre.onlineServices.imdb.parser.ImdbNameSearchParser;
import com.fxcalibre.utils.HTTPUtils;
import com.fxcalibre.utils.LookupVO;

public class ImdbNameSearch
{

	public static HashMap<String, String> findById(String imdbId)
	{
		LookupVO lookupVO = new LookupVO();
		lookupVO.setUrl("http://www.imdb.com" + imdbId);
		lookupVO = HTTPUtils.sendRequest(lookupVO);

		return ImdbDetailParser.parse(lookupVO.getResult());
	}
	
	public static List<NameResult> search(String name)
	{
		LookupVO lookupVO = new LookupVO();
		lookupVO.setUrl("http://www.imdb.com/search/name?name=" + name);
		lookupVO = HTTPUtils.sendRequest(lookupVO);

		return ImdbNameSearchParser.parse(lookupVO.getResult());
	}

	public static void main(String[] args)
	{
		//System.out.println(ImdbNameSearch.findById("nm0000399"));
		System.out.println(ImdbNameSearch.search("lexi belle"));

	}
}
